﻿CREATE TABLE [entity].[Organization] (
    [OrganizationID]              INT           IDENTITY (1, 1) NOT NULL,
    [EntityID]                    INT           NULL,
    [OrganizationTypeID]          INT           NULL,
    [Name]                        VARCHAR (500) NULL,
    [CreationDate]                DATETIME      NULL,
    [OrganizationContactEntityID] INT           NULL,
    [CreatedBy]                   VARCHAR (50)  NULL,
    [CreatedDate]                 DATETIME      NULL,
    [UpdatedBy]                   VARCHAR (50)  NULL,
    [UpdatedDate]                 DATETIME      NULL,
    [EndDate]                     DATETIME      NULL,
    CONSTRAINT [PK_Organization] PRIMARY KEY CLUSTERED ([OrganizationID] ASC),
    CONSTRAINT [FK_Organization_Entity] FOREIGN KEY ([EntityID]) REFERENCES [entity].[Entity] ([EntityID]),
    CONSTRAINT [FK_Organization_OrganizationType] FOREIGN KEY ([OrganizationTypeID]) REFERENCES [entity].[OrganizationType] ([OrganizationTypeID])
);

